<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input id="inp" type="text">

    <input class="ck" type="checkbox" name="a" id="">
    <input class="ck" type="checkbox" name="a" id="">
    <input class="ck" type="checkbox" name="a" id="">

    <script>

        // const inp = document.querySelector('#inp');

        // inp.addEventListener('input', function () {
        //     // inp.value: input框中输入的值
        //     console.log(inp.value);
        //     console.log(this.value);
        // });

        // console.log(inp.value);

        const checkboxes = document.querySelectorAll('.ck');

        for (const checkbox of checkboxes) {
            checkbox.addEventListener('click', function () {
                console.log(checkbox.checked);
            });
        }

    </script>
</body>
</html>